import request from '@/utils/request'

export function add(data) {
  return request({
    url: 'api/buyOrder/addOrSave',
    method: 'post',
    data
  })
}

export function del(ids) {
  return request({
    url: 'api/buyOrder',
    method: 'delete',
    data: ids
  })
}

export function history(data) {
  const obj = {
    url: '/api/basGoods/buyHistory',
    method: 'post',
    data
  }
  return request(obj)
}

export function edit(data) {
  return request({
    url: 'api/buyOrder/addOrSave',
    method: 'post',
    data
  })
}
export function copy(data) {
  return request({
    url: 'api/buyOrder/copy',
    method: 'post',
    data
  })
}

export function passOrReject(data) {
  const obj = {
    url: 'api/buyOrder/passOrReject',
    method: 'post',
    data
  }
  return request(obj)
}

export function enableOrDisable(data) {
  const obj = {
    url: 'api/buyOrder/passOrReject',
    method: 'post',
    data
  }
  return request(obj)
}
export function detail(data) {
  const obj = {
    url: 'api/buyOrder/detail',
    method: 'post',
    data
  }
  return request(obj)
}
export function exportDe(data) {
  const obj = {
    url: 'api/buyOrder/export',
    method: 'get',
    data
  }
  return request(obj)
}
export function exportDetail(data) {
  const obj = {
    url: 'api/buyOrder/exportDetail',
    method: 'get',
    data
  }
  return request(obj)
}

export function importDe(data) {
  const obj = {
    url: 'api/buyOrder/import',
    method: 'post',
    data
  }
  return request(obj)
}
export function removeDetail(data) {
  const obj = {
    url: 'api/buyOrder/removeDetail',
    method: 'post',
    data
  }
  return request(obj)
}
export function accept(data) {
  const obj = {
    url: 'api/buyOrder/accept',
    method: 'post',
    data
  }
  return request(obj)
}
export function unAccept(data) {
  const obj = {
    url: 'api/buyOrder/unAccept',
    method: 'post',
    data
  }
  return request(obj)
}
export function print(data) {
  const obj = {
    url: 'api/buyOrder/print',
    method: 'post',
    responseType: 'blob',
    data
  }
  return request(obj)
}
export function getBuyOrderPreviousNextPageIdList(data) {
  const obj = {
    url: '/api/buyOrder/getBuyOrderPreviousNextPageIdList',
    method: 'get',
    params: data
  }
  return request(obj)
}
export default { add, edit, del, passOrReject, copy, detail, exportDe, exportDetail, importDe, removeDetail, enableOrDisable, unAccept, accept, print }
